<?php
/**
 * Created by PhpStorm.
 * User: papa
 * Date: 18/5/10
 * Time: 11:47
 */

namespace app\api\model;


class Banner extends BaseModel
{
    protected $hidden = ['create_time','update_time','description'];

    public function item()
    {
        return $this->hasMany('BannerItem','banner_id','id');
    }

    public static function getBanner($id)
    {
        return self::with(['item'=>function($query){
            $query->where(['is_use'=>1]);
        }])->find($id);
    }
}